import request from './request'

export const getTcmCategoriesApi = () => {
  return request({
    url: '/tcm-encyclopedia/categories',
    method: 'GET'
  })
}

export const getTcmKnowledgeListApi = (params) => {
  return request({
    url: '/tcm-encyclopedia/list',
    method: 'GET',
    params
  })
}

export const searchTcmKnowledgeApi = (query) => {
  return request({
    url: '/tcm-encyclopedia/search',
    method: 'GET',
    params: { query }
  })
}

export const getTcmKnowledgeDetailApi = (id) => {
  return request({
    url: `/tcm-encyclopedia/${id}`,
    method: 'GET'
  })
}

export const toggleCollectApi = (id, isCollected) => {
  return request({
    url: `/tcm-encyclopedia/collect/${id}`,
    method: 'POST',
    data: { isCollected }
  })
} 